home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / SLAX 6.0.8 / slax-6.0.8.iso / slax / base / 006-devel.lzm / usr / include / kio / defaultprogress.h < prev    next >
Encoding:
C/C++ Source or Header  |  2007-01-15  |  4.7 KB  |  165 lines

  1. /* This file is part of the KDE libraries
  2.    Copyright (C) 2000 Matej Koss <koss@miesto.sk>
  3.  
  4.    This library is free software; you can redistribute it and/or
  5.    modify it under the terms of the GNU Library General Public
  6.    License version 2 as published by the Free Software Foundation.
  7.  
  8.    This library is distributed in the hope that it will be useful,
  9.    but WITHOUT ANY WARRANTY; without even the implied warranty of
  10.    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  11.    Library General Public License for more details.
  12.  
  13.    You should have received a copy of the GNU Library General Public License
  14.    along with this library; see the file COPYING.LIB.  If not, write to
  15.    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  16.    Boston, MA 02110-1301, USA.
  17. */
  18. #ifndef __defaultprogress_h__
  19. #define __defaultprogress_h__
  20.  
  21. #include <qlabel.h>
  22.  
  23. #include <kio/global.h>
  24.  
  25. #include <kprogress.h>
  26.  
  27. #include "progressbase.h"
  28.  
  29. class KLineEdit;
  30.  
  31. namespace KIO {
  32.  
  33. /*
  34.  * A default implementation of the progress dialog ProgressBase.
  35.  * ProgressBase
  36.  */
  37. class KIO_EXPORT DefaultProgress : public ProgressBase {
  38.  
  39.   Q_OBJECT
  40.  
  41. public:
  42.   /**
  43.    * Creates a new default progress dialog.
  44.    * @param showNow true to show immediately, false to show when
  45.    *                needed
  46.    */
  47.   DefaultProgress( bool showNow = true );
  48.   /**
  49.    * Creates a new default progress dialog.
  50.    * @param parent the parent of the dialog (or 0 for top-level)
  51.    * @param name the name of the dialog, can be 0
  52.    * @since 3.1
  53.    */
  54.   DefaultProgress( QWidget* parent, const char* name = 0 );
  55.   ~DefaultProgress();
  56.  
  57.   bool keepOpen() const;
  58.  
  59.   /// Shared with uiserver.cpp
  60.   static QString makePercentString( unsigned long percent,
  61.                                     KIO::filesize_t totalSize,
  62.                                     unsigned long totalFiles );
  63.  
  64. public slots:
  65.   virtual void slotTotalSize( KIO::Job *job, KIO::filesize_t size );
  66.   virtual void slotTotalFiles( KIO::Job *job, unsigned long files );
  67.   virtual void slotTotalDirs( KIO::Job *job, unsigned long dirs );
  68.  
  69.   virtual void slotProcessedSize( KIO::Job *job, KIO::filesize_t bytes );
  70.   virtual void slotProcessedFiles( KIO::Job *job, unsigned long files );
  71.   virtual void slotProcessedDirs( KIO::Job *job, unsigned long dirs );
  72.  
  73.   virtual void slotSpeed( KIO::Job *job, unsigned long speed );
  74.   virtual void slotPercent( KIO::Job *job, unsigned long percent );
  75.   /**
  76.    * Called to set an information message.
  77.    * @param job the KIO::Job
  78.    * @param msg the message to set
  79.    */
  80.   virtual void slotInfoMessage( KIO::Job *job, const QString & msg );
  81.  
  82.   virtual void slotCopying( KIO::Job* job, const KURL& src, const KURL& dest );
  83.   virtual void slotMoving( KIO::Job* job, const KURL& src, const KURL& dest );
  84.   virtual void slotDeleting( KIO::Job* job, const KURL& url );
  85.   /**
  86.    * Called when the job is transferring.
  87.    * @param job the KIO::Job
  88.    * @param url the url to transfer
  89.    * @since 3.1
  90.    */
  91.   void slotTransferring( KIO::Job* job, const KURL& url );
  92.   virtual void slotCreatingDir( KIO::Job* job, const KURL& dir );
  93.   /**
  94.    * Called when the job is requesting a stat.
  95.    * @param job the KIO::Job
  96.    * @param dir the dir to stat
  97.    * @since 3.1
  98.    */
  99.   virtual void slotStating( KIO::Job* job, const KURL& dir );
  100.   /**
  101.    * Called when the job is mounting.
  102.    * @param job the KIO::Job
  103.    * @param dev the device to mount
  104.    * @param point the mount point
  105.    */
  106.   virtual void slotMounting( KIO::Job* job, const QString & dev, const QString & point );
  107.   /**
  108.    * Called when the job is unmounting.
  109.    * @param job the KIO::Job
  110.    * @param point the mount point
  111.    */
  112.   virtual void slotUnmounting( KIO::Job* job, const QString & point );
  113.   virtual void slotCanResume( KIO::Job* job, KIO::filesize_t from);
  114.  
  115.   /**
  116.    * Called when the job is cleaned.
  117.    * @since 3.1
  118.    */
  119.   void slotClean();
  120.  
  121. protected:
  122.   /// @since 3.1
  123.   void init();
  124.   void showTotals();
  125.   void setDestVisible( bool visible );
  126.   /// @since 3.1
  127.   void checkDestination( const KURL& dest);
  128.  
  129.   KLineEdit* sourceEdit;
  130.   KLineEdit* destEdit;
  131.   QLabel* progressLabel;
  132.   QLabel* destInvite;
  133.   QLabel* speedLabel;
  134.   QLabel* sizeLabel;
  135.   QLabel* resumeLabel;
  136.  
  137.   KProgress* m_pProgressBar;
  138.  
  139.   KIO::filesize_t m_iTotalSize;
  140.   unsigned long m_iTotalFiles;
  141.   unsigned long m_iTotalDirs;
  142.  
  143.   KIO::filesize_t m_iProcessedSize;
  144.   unsigned long m_iProcessedDirs;
  145.   unsigned long m_iProcessedFiles;
  146.  
  147.   enum ModeType { Copy, Move, Delete, Create, Done };
  148.   ModeType mode;
  149.  
  150. protected:
  151.   virtual void virtual_hook( int id, void* data );
  152. private:
  153.   class DefaultProgressPrivate;
  154.   DefaultProgressPrivate* d;
  155. private slots:
  156.   void slotKeepOpenToggled(bool);
  157.   void slotOpenFile();
  158.   void slotOpenLocation();
  159. };
  160.  
  161. } /* namespace */
  162.  
  163. #endif // __defaultprogress_h__
  164.  
  165.